home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Database
/
Evaluator
/
Controller.m
< prev
next >
Wrap
Text File
|
1993-07-21
|
1KB
|
73 lines
/* Controller.m:
* You may freely copy, distribute, and reuse the code in this example.
* NeXT disclaims any warranty of any kind, expressed or implied, as to its
* fitness for any particular use.
*
*
*
*/
#import "Controller.h"
#import "SQLWindow.h"
@implementation Controller
#define DEFAULT_LIBRARY "Library/Databases"
- open:sender
{
char **files;
char *path;
const char *directory;
const char *const types[] = { "dbmodel", "dbmodela", 0 };
id openPanel;
openPanel = [OpenPanel new];
[openPanel allowMultipleFiles:YES];
path = alloca(1 + MAXPATHLEN);
sprintf(path, "%s/%s", getenv("HOME"), DEFAULT_LIBRARY);
if ([openPanel runModalForDirectory:path file:NULL types:types])
if ((files = (char **) [openPanel filenames]) != NULL)
{
directory = [openPanel directory];
for (; *files; ++files)
{
sprintf(path, "%s/%s", directory, *files);
[self openFileNamed:path];
}
}
return self;
}
- openFileNamed:(const char *)filename
{
return [[SQLWindow alloc] initWithFile:filename];
}
- evaluate:sender
{
[[[NXApp mainWindow] delegate] evaluate:sender];
return self;
}
- clear:sender
{
[[[NXApp mainWindow] delegate] clear:sender];
return self;
}
- print:sender
{
[[[NXApp mainWindow] delegate] print:sender];
return self;
}
- close:sender
{
[[[NXApp mainWindow] delegate] performClose:sender];
return self;
}
@end